package com.hnust.api;

import com.github.lianjiatech.retrofit.spring.boot.annotation.RetrofitClient;
import com.hnust.domain.*;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import retrofit2.Call;
import retrofit2.http.*;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

/**
 * 创建人：zhangRuWang
 * 创建时间：2020/10/28
 * 描述：
 */
@RetrofitClient(baseUrl = "${retrofit.baseUrl}",poolName = "test2",connectTimeoutMs = 50000,writeTimeoutMs = 50000,readTimeoutMs = 50000)
@Component
public interface TestPaperApi {
    @GET("/api/subject/getCourseData")
    Call<Result<List<CourseData>>> getCourseData(@Query("id") String id,@Query("token") String token);

    //获取该课程的题型
    @GET("/api/teacher/testpaper/getQuesTypeList")
    Call<Result<List<QuestionType>>> getCourseQuesList(@Query("token")String token,@Query("id") String id);  //ID为courseId

    //获取该课程对应的题型题库
    @GET("/api/teacher/testpaper/getCourseQuesList")
    Call<Result<SubjectInfo>> getQuestion(@Query("token")String token,@Query("course_id")String course_id,@Query("type_id")String type_id,@Query("now_page")String now_page);

    //搜索题目
    @GET("/api/teacher/testpaper/getQuesByCon")
    Call<Result<SubjectInfo>> getQuesByCon(@Query("token")String token,@Query("id")String id,@Query("course_id")String course_id,@Query("type_id")String type_id,@Query("keyword")String keyword,@Query("diff")Integer diff,@Query("now_page")String now_page);

    //试卷查重
    @GET("/api/teacher/testpaper/checkPaperRepeat")
    Call<Result<List<RepeatQues>>> checkPaperRepeat(@Query("token") String token,@Query("id") String id,@Query("course_id")String course_id,@Query("subject_ids")List<String> subject_ids);

    //题目设为隐藏
    @GET("/api/teacher/testpaper/setDisableQue")
    Call<Result<Boolean>> setDiasbleQue(@Query("token") String token,@Query("subject_ids")List<String> subject_ids);

    //保存成生成试卷
    @POST("/download/create")
    Call<Result<String>> create(@Body GeneratePaperInfoRecord generatePaperInfoRecord);

    //下载试卷PDF
    @GET("/download/paperpdf")
    Call<ResponseBody> getPaperpic(@Query("paperId") String paperId);

    //下载试卷WORD
    @GET("/download/paperdocx")
    Call<ResponseBody> getPaperdocx(@Query("paperId") String paperId);

    //下载试卷答案
    @GET("/download/paperanswer")
    Call<ResponseBody> getPaperAnswerdocx(@Query("paperId") String paperId);

    //下载出题计划表
    @GET("/download/paperplan")
    Call<ResponseBody> getPaperPlandocx(@Query("paperId") String paperId);

    //自动生成试卷获取题目
    @Multipart
    @POST("/api/teacher/testpaper/getAutoPaper")
    Call<Result<List<SubjectData>>> getAutoPaper(@Part("course_id")String course_id, @Part("list") RequestBody list, @Part("token") String token);

    @GET("download/question")
    Call<Result<File>> getTem();




    //将试卷设为样卷
    //@GET("api/teacher/testpaper/changePaperType")
    //Call<Result<Integer>> changePaperType(@Query("token") String token,@Query("paper_ids") List<String> paper_id);

    //预览试卷
    @GET("/download/paperpic")
    Call<Result<Object>> getPaperPreview(@Query("paperId") String paperId );

    //取消样卷
    @GET("api/teacher/testpaper/removePaperType")
    Call<Result<Integer>> removePaperType(@Query("token") String token,@Query("paper_ids")  List<String> paper_ids);


    //教师端补充

    //获取某学科的所有试卷
//    @GET("https://www.fastmock.site/mock/1c5a4eeb95389d6a6525b8b05be64c6a/examSystem/getExamList")

    @GET("/paper/getExamList")
//    @GET("http://47.113.203.45:8001/paper/getExamList")
    Result<List<Test>> getExamList(@Query("subject") String subject, @Query("pap_name") String pap_name);


    //将试卷设为样卷
//    @GET("api/teacher/testpaper/changePaperType")
    @GET("/paper/changePaperType")
    Result<Object> changePaperType(@Query("paper_ids") ArrayList<String> paper_ids);

    //取消样卷
//    @GET("api/teacher/testpaper/removePaperType")
    @GET("/paper/removePaperType")
    Result<Object> removePaperType(@Query("paper_ids") ArrayList<String> paper_ids);

    //删除试卷
//    @GET("http://127.0.0.1:8001/paper/delTestPaper")
//    Result<Object> deletePaper(@Query("paper_ids") ArrayList<String> paper_ids);
//
//    //初始化页面时候的数据
//    //@GET("https://www.fastmock.site/mock/1c5a4eeb95389d6a6525b8b05be64c6a/examSystem/getAllExam")
////    @GET("http://127.0.0.1:8001/paper/getAllExam")
//    @GET("http://127.0.0.1:4523/m1/418628-0-default/paper/getAllExam?id=123")
//    Result<List<Test>> getAllExams();

    //删除试卷
//    @GET("/paper/delTestPaper")
    @GET("/api/teacher/testpaper/delTestPaper")
    Result<Object> deletePaper(@Query("paper_ids") ArrayList<String> paper_ids);

    //初始化页面时候的数据
    //   @GET("https://www.fastmock.site/mock/1c5a4eeb95389d6a6525b8b05be64c6a/examSystem/getAllExam")
    @GET("/paper/getAllExam")
    Result<List<Test>> getAllExams();

    // 获取待批阅以及已完成所有试卷列表
    @GET("/api/teacher/testpaper/getReviewAll")
    //@GET("http://127.0.0.1:8001/m1/418628-0-default/api/teacher/testpaper/getReviewAll")
    Result<List<Test>> getNeedCorrectExams(@Query("teaNum")String teaNum);

    //获取待开始的试卷列表
    @GET("/api/teacher/testpaper/getPaperList")
    Result<List<Test>> getUnstartedExams(@Query("teaNum")String teaNum);

    //获取考试信息
//    @GET("http://47.113.203.45:8001/api/paperCorrect/getTest")
    @GET("/api/paperCorrect/getTest")
//    @GET("http://127.0.0.1:4523/mock/418628/api/paperCorrect/getTest")
    Result<TestMessage> getTest(@Query("paperId")String paperId);

    //获取选择题
//    @GET("http://47.113.203.45:8001/api/paperCorrect/getChoiceQuestions")
    @GET("/api/paperCorrect/getChoiceQuestions")
    Result<List<ChoiceTestQuestions>> getChoiceQuestions(@Query("paperId")String paperId);

    //获取判断题
//    @GET("http://47.113.203.45:8001/api/paperCorrect/getJudgeQuestions")
    @GET("/api/paperCorrect/getJudgeQuestions")
    Result<List<JudgeTestQuestions>> getJudgeQuestions(@Query("paperId")String paperId);

    //获取填空题
//    @GET("http://47.113.203.45:8001/api/paperCorrect/getGapQuestions")
    @GET("/api/paperCorrect/getGapQuestions")
    Result<List<GapTestQuestions>> getGapQuestions(@Query("paperId")String paperId);

    //获取简答题

//    @GET("http://47.113.203.45:8001/api/paperCorrect/getEssayQuestions")
    @GET("/api/paperCorrect/getEssayQuestions")
    Result<List<EssayTestQuestions>> getEssayQuestions(@Query("paperId")String paperId);

//    发布考试
//@POST("http://47.113.203.45:8002/release/examInfo2")
//@POST("/release/examInfo2")
//    Call<Result<String>> publishPaper(@Body PublishPaperInfo publishPaperInfo);

}
